<template>
  <div class="u-base-info">
    <a-descriptions bordered size="small" style="margin-top:20px;">
      <a-descriptions-item label="企业名称" span="3">
        <span class="item-content">{{ infoData.nameDwzw }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="组织机构代码号" span="1.5">
        <span class="item-content">{{ infoData.codeZzjg }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="组织机构登记机关" span="1.5">
        <span class="item-content">{{ infoData.unitZzjgdjjg }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="单位类别" span="1.5">
        <span class="item-content">{{ dictText('单位类别',infoData.typeDw) }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="法定代表人" span="1.5">
        <span class="item-content">{{ infoData.representFr }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="技术负责人" span="1.5">
        <span class="item-content">{{ infoData.leaderTk }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="注册资本金" span="1.5">
        <span class="item-content">{{ infoData.capitalZc }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="成立日期" span="1.5">
        <span class="item-content"  v-if="infoData.dateCl!=='' && infoData.dateCl!==null">
          {{ moment(infoData.dateCl).format("YYYY-MM-DD") }}
        </span>
      </a-descriptions-item>
      <a-descriptions-item label="营业起始日期" span="1.5">
        <span class="item-content" v-if="infoData.startdateYy!=='' && infoData.startdateYy!==null">
          {{ moment(infoData.startdateYy).format("YYYY-MM-DD") }}
        </span>
      </a-descriptions-item>
      <a-descriptions-item label="经营范围" span="3">
        <span class="item-content">{{ infoData.rangeOperrating }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="安全生产许可证编号" span="1.5">
        <span class="item-content">{{ infoData.numsAqscxkz }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="安全生产许可证有效期" span="1.5">
        <span class="item-content" v-if="infoData.effictivedateAqscxkz!=='' && infoData.effictivedateAqscxkz!==null">
          {{ moment(infoData.effictivedateAqscxkz).format("YYYY-MM-DD") }}
        </span>
      </a-descriptions-item>
      <a-descriptions-item label="企业地址" span="3">
        <span class="item-content">{{ infoData.addressJy }}</span>
      </a-descriptions-item>
      <a-descriptions-item label="附件" span="3">
        <template v-for="(item,index) in infoData.fileupload">
          <div  :key="index" style="margin-bottom:5px;" >
            {{item.name}}  <a @click="downloadPDf(item)">下载</a>
           </div>
        </template>
      </a-descriptions-item>
    </a-descriptions>
  </div>
</template>

<script>
import emv from "@/views/center/emptyVue.vue";
import download from 'downloadjs';
import api from "@/api"; // 引用插件
export default {
  props: {
    infoData: {
      type: Object
    }
  },
  data() {
    return {
      dictDW:[]
    };
  },
  created() {
    emv.$emit("setfootmargintop",10);
    this.dictList()
  },
  methods: {
    downloadPDf(item){
          download("/api"+item.path);
    },
    //字典获取
    async dictList(){
      await api.get_dict().then(ser => {
        this.dictDW = ser
        // console.log(this.dictDW)
      })
    },
    dictText(val,text){
      let list = []
      var arr = (text || '').split(`,`)
      console.log(arr)
      for(let item of arr){
        for(let index of this.dictDW){
          if(item === index.dictValue && val === index.dictType){
            list.push(index.dictLabel)
          }
        }
      }
      if(list.length !== 0){
        return list.toString()
      } else {
        return text
      }
    }
  }
}
</script>

<style lang="less">
.u-base-info {
  margin-bottom: -18px;
  .item-content {
    font-size: 14px;
    font-family: Microsoft YaHei;
    font-weight: 400;
    color: #333333;
  }
  // .ant-descriptions-bordered.ant-descriptions-small
  //   .ant-descriptions-item-label {
  //   padding: 8px 16px;
  //   text-align: center;
  //   color: #333333;
  //   font-size: 13px;
  //   font-family: Microsoft YaHei;
  //   font-weight: 400;
  //   width: 150px;
  // }
  // .ant-descriptions-bordered.ant-descriptions-small
  //   .ant-descriptions-item-content {
  //   padding: 8px 16px;
  //   text-align: left;
  //   color: #333333;
  //   font-size: 13px;
  //   font-family: Microsoft YaHei;
  //   font-weight: 400;
  //   // width: 150px;
  // }
}
</style>
